<html lang="en"><head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    </head><body><textarea name="" id="config" cols="30" rows="10">[
      {
          "src": "/32ludemo/#/zego",
          "count": 32
      },
      {
          "src": "/32ludemo/#/agora",
          "count": 0
      }
  ]
    </textarea>
  
  
  
    <button id="btn">点击生成 iframe</button>
    <button id="reset">重置</button>
    <div id="frame"></div>
    <script>
      function getConfig() {
        const ta = document.getElementById("config")?.value
        try {
          const json = JSON.parse(ta)
          console.log("get config",json)
          return json
        } catch (error) {
          return []
          console.error(error)
        }
      }
  
      var btn = document.getElementById('btn');
      btn.addEventListener('click', function () {
        const config = getConfig();
        window.ac = new (typeof webkitAudioContext !== "undefined"
          ? webkitAudioContext
          : AudioContext)();
        for (let index = 0; index < config.length; index++) {
          const element = config[index];
  
          for (var i = 0; i < element.count; i++) {
            var iframe = document.createElement('iframe');
            iframe.src = element.src+"?time="+Date.now(); // 或者设置其他的URL地址
            document.querySelector("#frame").appendChild(iframe);
          }
        }
      });
      var reset = document.getElementById('reset');
      reset.addEventListener('click', function () {
        document.querySelector("#frame").innerHTML = ""
      });
    </script>
  
  
  </body></html>